package battleships;
/**
* Title: Ships
* Description: Ship data
* @main author: Jake Kooiman
* @email jake.kooiman@my.uwrf.edu
* @editors:
* @last update: 12/1/11
* 
*/

public class ships {
	
	/**
	 * Types of Ships:
	 * Aircraft Carrier x1 - Length = 5
	 * Battleship x1 - Length = 4
	 * Submarine x1 - Length = 3
	 * Destroyer x1 - Length = 3
	 * Patrol Boat x1 - Length = 2
	 */

	private boolean Sunk;
	private String Name;
	private int Length;
	private int Health;
	private int Hits;
	
	public void main() {
		Sunk = true;
		Name = null;
		Length = 0;
		Health = 0;
		Hits = 0;
	}
//	This should be the method called when creating new ships.
//	All ships should should start with no hits and not sunk (Sunk = False)
//	Only send in the ships Name, Length and Health
	public  ships(String newName, int newLength, int newHealth){
		Sunk = false;
		Name = newName;
		Length = newLength;
		Health = newHealth;
		Hits = 0;
	}
	
	
	
	public boolean shipHit(){
		Hits = Hits + 1;
		if(Health <= Hits){
			shipSunk();
		}
		return Sunk;
	}
	private void shipSunk(){
		Sunk = true;
	}

//	Getters and Setters
	public boolean getSunk(){
		return Sunk;
	}
	public String getName(){
		return Name;
	}
	public int getLength(){
		return Length;
	}
	public int getHealth(){
		return Health;
	}
	public int getHits(){
		return Hits;
	}
	
	public void setSunk(){
		if(Sunk == false)
			Sunk = true;
		else
			Sunk = false;		
	}
	public void setName(String newName){
		Name = newName;
	}
	public void setLength(int newLength){
		Length = newLength;
	}
	public void setHealth(int newHealth){
		Health = newHealth;
	}
	public void setHits(int newHits){
		Hits = newHits;
	}
	public String toString(){
		return "Name: " + Name + " Length: " + Length + " Health: " + Health + " Hits: " + Hits;
			
	}
}
